/**
 * FileName: UserFeign
 * Author:   Administrator
 * Date:     2018/11/16 17:14
 * Description: 后台用户管理模块
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.fortune.rainshine.feign.common;

import com.fortune.rainshinecommon.base.MsgModel;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 〈一句话功能简述〉<br>
 * 〈后台用户管理模块〉
 *
 * @author Administrator
 * @create 2018/11/16
 * @since 1.0.0
 */
@FeignClient(value = "rain-shine-common")
@RestController
public interface RedisFeign {
	
	//根据key获取value
	@GetMapping("/common/get/{key}")
	MsgModel get(@PathVariable(name = "key") String key);
	
	// 向redis里存入数据永不過期
	@PostMapping("/common/set/{key}/{value}")
	boolean set(@PathVariable(name = "key") String key, @PathVariable(name = "value") String value);

	//存入数据，有过期时间
	@PostMapping("/common/set/{key}/{value}/{time}")
	boolean set(@PathVariable(name = "key") String key, @PathVariable(name = "value") String value,
			@PathVariable(name = "time") Integer time);

	//根据key删除数据
	@GetMapping("/common/delete/{key}")
	boolean delete(@PathVariable(name = "key") String key);

	//更新数据过期时间
	@GetMapping("/common/updateTime/{key}")
	boolean updateTime(@PathVariable(name = "key") String key, @PathVariable(name = "time") Integer time);

	//判断数据是否存在
	@GetMapping("/common/exists/{key}")
	boolean exists(@PathVariable(name = "key") String key);

	//插入对象以及过期时间
	@GetMapping("/common/postEntity/{key}/{object}")
	boolean postEntity(@PathVariable(name = "key") String key, @PathVariable(name = "object") Object o,
			@PathVariable(name = "time") Integer time);

	//genjukey获取对象
	@GetMapping("/common/getEntity/{key}")
	Object getEntity(@PathVariable(name = "key") String key, @PathVariable(name = "object") Object o);

}